<template>
  <div id="yoso">
    <el-form ref="form" :model="hotword" label-width="80px">
      <el-form-item label="热词序号">
        <el-input v-model="hotword.hw_id" readonly="readonly"></el-input>
      </el-form-item>
      <el-form-item label="热词名称">
        <el-input v-model="hotword.hw_name"></el-input>
      </el-form-item>
      <el-form-item label="热词地址">
        <el-input v-model="hotword.hw_path"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">立即创建</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  export default {

    name: "HotWordUpdate",
    data(){
      return{
        hotword:{
          hw_name:'',
          hw_path:''
        }
      }
    },
    methods:{
      onSubmit(){
        var formData = new URLSearchParams();
        Object.keys(this.hotword).forEach(key=>{
          formData.append(key,this.hotword[key]);

        });
        this.$axios.post('/HotWordServlet/update',formData)
          .then(resp=>{
            this.$router.push('/page/hotword')
          })

      },
      paging(hw_id){
        this.$axios.get('/HotWordServlet/findById?hw_id='+hw_id)
          .then(resp=>{
            this.hotword =resp.data;
          })
      }
    },

    created() {
      this.paging(this.$route.params.id);
    }
  }
</script>

<style scoped>

</style>
